
<%@page import="com.crossriver.crgis.database.service.TransactionsLocalServiceUtil"%>
<%@page import="com.crossriver.crgis.database.model.Transactions"%>
<%@ include file="/init.jsp"%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.liferay.portal.kernel.util.PrettyDateFormat"%>


<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />


<%
Transactions transaction = (Transactions) request.getAttribute("transaction");
%>
<div id="main">
	<h1> Transactions &raquo; Transaction Details</h1>
	<div class="content"> 
	
	<liferay-ui:error key="transaction_cant_be_queried" message="transaction_cant_be_queried" />
	<liferay-ui:error key="transaction-no-found" message="transaction-no-found" />
	<liferay-ui:error key="webservice-call-for-query-failure-redo-for-complete-update"/>
	<liferay-ui:message key="webservice-call-for-query-successful-and-update-done"/>
		
                
		<portlet:actionURL name="deleteMessage" var="deleteMessage">
		<portlet:param name="msgId" value="<%%>" />
		</portlet:actionURL>
		
		<portlet:renderURL var="backUrl">
		<portlet:param name="jspPage" value="/html/botransactions/view.jsp" />
		</portlet:renderURL>
		
		<!-- Show this only if the there is no response code for the transaction -->
		<% 
		boolean show = false;
		if(null == transaction.getResponseCode() || "".equalsIgnoreCase(transaction.getResponseCode())){
			show = true;
		}
		%>
		<%-- <aui:layout cssClass="test">
			<aui:column>
				<aui:a href="<%= backUrl.toString() %>"><liferay-ui:icon src="${renderRequest.contextPath}/images/back.png" message="Back"/></aui:a>
			</aui:column>	
		</aui:layout> --%>	
		<hr>
		
		<aui:layout cssClass="test">
			<aui:column cssClass="bigtxt">
				Transaction Details
			</aui:column>	
		</aui:layout>	
    
		     
    <table id="transdetails" width="50%">
    	<tr>
      	<td width="25%">Transaction Reference:</td>
      	<td width="75%" class="tdet"><%= transaction.getTransactionRef() %></td>
			</tr>
<%-- 		<tr>
      	<td width="25%">Transaction Description:</td>
      	<td width="75%" class="tdet"><%= transaction.getItemDescription() %></td>
			</tr>
			<tr>
			 	<td>Bank Name:</td>
			 	<td class="tdet"><%=transaction.getBankName()  %></td>
			</tr>
	 --%>		<tr>
				<td>Application Type:</td>
			  <td class="tdet"><%= transaction.getApplicationType() %></td>
			</tr>
			<tr>
				<td>Payment Type:</td>
				<td class="tdet"><%=transaction.getPaymentType()  %></td>
			</tr>
			<tr>
				<td>Transaction No:</td>
				<td class="tdet"><%= transaction.getTransactionNo().toUpperCase() %></td>
			</tr>
			<tr>
				<td>Amount Paid:</td>
				<td class="tdet">&#8358;<%= transaction.getAmount() %></td>
			</tr>
			<tr>
				<td>Payment Reference:</td>
				<td class="tdet"><%= transaction.getPayRef() %></td>
			</tr>
			<tr>
				<td>Response:</td>
				<td class="tdet"><%= transaction.getResponseCode() %></td>
			</tr>
			<tr>
				<td>Transaction Response:</td>
				<td class="tdet"><%= transaction.getResponseDescription() %></td>
			</tr>
			<tr>
				<td>Client ID:</td>
				<td class="tdet"><%=transaction.getUserId() %></td>
			</tr>
			<tr>
				<td>Status:</td>
				<td class="tdet"><%=transaction.getStatus() %></td>
			</tr>
			<tr>
     		<td>Date of Transaction:</td>
       	<td class="tdet"><%=transaction.getPaymentDate() %></td>
			</tr>
			<tr>
				<td>Card Number (Last 4 Digits):</td>
				<td class="tdet"><%= transaction.getCardNum() %></td>
			</tr>
  	</table>		
		
		<hr>            
		<aui:layout cssClass="test">
			<aui:column>
				<aui:a href="<%= backUrl.toString() %>"><liferay-ui:icon src="${renderRequest.contextPath}/images/back.png" message="Back"/></aui:a>
			</aui:column>
						
			<%if(show) {%>
			<input name="query_Transaction" type="button" value="Query Transaction" onClick="queryTransaction();">
			<%} %>
		</aui:layout>	
    
    <p>For more information on Land Allocation, Recertification, LIS &amp; GIS contact us via the following:<br><br> 
		Customer Relations Unit, CRGIS,<br>
		<img src="${renderRequest.contextPath}/images/mail.jpg" align="absmiddle">admin@crgis.com.ng<br>  
   	<img src="${renderRequest.contextPath}/images/tel.jpg" align="absmiddle"> +234 (02) 7689908, 7689909 </p>               
  </div>
</div>

<liferay-portlet:actionURL name="queryTransaction" var="queryTransaction"></liferay-portlet:actionURL>

<form name="<portlet:namespace/>queryTransaction_fm" method="post"	id="<portlet:namespace/>queryTransaction_fm" action="<%=queryTransaction.toString()%>">
	<input type="hidden" id="<portlet:namespace/>transid" value="<%= transaction.getTransactionNo() %>" name="<portlet:namespace/>transid"/> 
</form>

<script type="text/javascript">
<!--
	
	function queryTransaction()
	{
		document.forms["<portlet:namespace/>queryTransaction_fm"].submit();
	}

//-->
</script>